package com.mytecblog.framework.controller.handler;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Spring Mvc统一异常处理类，用于输出后台错误堆栈
 * @author yg.huang
 * @version v1.0
 *          DATE  2016/11/1
 */
public class SpringMappingExceptionResolver extends SimpleMappingExceptionResolver {
    Logger logger=Logger.getLogger(this.getClass());
    @Override
    protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
        logger.error("发生错误",ex);
        return super.doResolveException(request, response, handler, ex);
    }
}
